'use strict'

import {app, globalShortcut, session} from 'electron'
import initWindow from './services/windowManager'
import DisableButton from './config/DisableButton'
// const  path=require('path')
import installExtension, {VUEJS_DEVTOOLS} from 'electron-devtools-installer'
import {createLogger} from "vuex";

// const { default: installExtension, VUEJS_DEVTOOLS } = require('electron-devtools-installer');

  function onAppReady() {
    initWindow()
    DisableButton.Disablef12()
    if (process.env.NODE_ENV === 'development') {
         session.defaultSession.loadExtension('/Users/daijunxiong/Library/Application Support/Google/Chrome/Default/Extensions/nhdogjmejiglipccpnnnanhbledajbpd/5.3.3_0')
        // openDevTools();
    }
}
// app.whenReady().then( () => {
//     onAppReady()
//     session.loadExtension('/Users/daijunxiong/WebstormProjects/vue-devtools/shells/chrome')
//
// })
app.isReady() ? onAppReady() : app.on('ready', onAppReady)
// 解决9.x跨域异常问题
app.commandLine.appendSwitch('disable-features', 'OutOfBlinkCors')

app.on('window-all-closed', () => {
    // 所有平台均为所有窗口关闭就退出软件
    app.quit()
})
app.on('browser-window-created', () => {
    console.log('window-created')
})

if (process.defaultApp) {
    if (process.argv.length >= 2) {
        app.removeAsDefaultProtocolClient('electron-vue-template')
        console.log('有于框架特殊性开发环境下无法使用')
    }
} else {
    app.setAsDefaultProtocolClient('electron-vue-template')
}

require('./shotcutKey/shotcutKey')
